export function setStorage<T> (key: string, payload: T) {
  window.localStorage.setItem(key, JSON.stringify(payload))
}

export function getStorage<T = any> (key: string): T {
  return JSON.parse(window.localStorage.getItem(key)!)
}

export function removeStorage (key: string): void {
  window.localStorage.removeItem(key)
}

export function hasStorage (key: string): boolean {
  return !!getStorage(key)
}
